package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 展厅验收记录
 * </p>
 *
 * @author linan
 * @date 2023-01-09
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "SpaceAcceptanceDealResultEnum", description = "处理结果 #{SITE_ACCEPTANCE_IS_QUALIFIED:场地验收合格;UNQUALIFIED_SITE_DAMAGE:场地损坏不合格-枚举")
public enum SpaceAcceptanceDealResultEnum implements BaseEnum {

    /**
     * SITE_ACCEPTANCE_IS_QUALIFIED="场地验收合格"
     */
    SITE_ACCEPTANCE_IS_QUALIFIED("场地验收合格"),
    /**
     * UNQUALIFIED_SITE_DAMAGE="场地损坏不合格"
     */
    UNQUALIFIED_SITE_DAMAGE("场地损坏不合格"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static SpaceAcceptanceDealResultEnum match(String val, SpaceAcceptanceDealResultEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static SpaceAcceptanceDealResultEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(SpaceAcceptanceDealResultEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "SITE_ACCEPTANCE_IS_QUALIFIED,UNQUALIFIED_SITE_DAMAGE", example = "SITE_ACCEPTANCE_IS_QUALIFIED")
    public String getCode() {
        return this.name();
    }

}
